<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<html lang="zh">
<head>
    <title>退款</title>

    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="viewport"
          content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">

</head>

<body>

<div>

    <div>
        <h5 style="margin-top: 10px">请填写退款原因</h5>
    </div>


    <label>
        <input style="display: block;

        margin-top: 10px;
    position: relative;
    margin-left: 8%;
    padding: 10px 2%;
    border: 1px solid #ddd;
    transition: .3s;
    font-size: 14px;
    color: #666;
    width: 80%;" type="text" id="refund_reason" placeholder="退款原因">
    </label>

    <button style="    display: block;
    height: 40px;
    line-height: 40px;
    width: 84%;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
    background: #3f89ec;
    border: 0;
    margin-left: 8%;
    margin-top: 10px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -webkit-transition: .3s;
    -moz-transition: .3s;
    -o-transition: .3s;
    transition: .3s;" id="refund_accept_submit">提交
    </button>
</div>

<script>

    $('#refund_accept_submit').click(function () {

        let rs = $('#refund_reason').val();

        if (rs.length <= 2) {
            alert('退款原因必须多于两个字');
        } else {

            $.post('/order/pay/refund', {id: '${orderId}', reason: rs}, function () {

                //提交成功后执行
                Event.fanout('order.refund.ok', '${orderId}');
                mydialog.close();

            }).error(function (err) {

                console.log(err);

            });
        }

    });

</script>
</body>
</html>